package com.example.hospital_208.service.impl;

import com.example.hospital_208.dao.PatientDoctorDao;
import com.example.hospital_208.po.PatientDoctor;
import com.example.hospital_208.po.PatientInfo;
import com.example.hospital_208.service.PatientDoctorService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatientDoctorServiceImpl implements PatientDoctorService {

    private final PatientDoctorDao patientDoctorDao;

    public PatientDoctorServiceImpl(PatientDoctorDao patientDoctorDao) {
        this.patientDoctorDao = patientDoctorDao;
    }

    @Override
    public List<PatientDoctor> listPatientDoctors() {
        return patientDoctorDao.findAllPatientDoctors();
    }

    @Override
    public PatientDoctor getPatientDoctorById(Integer id) {
        return patientDoctorDao.findPatientDoctorById(id);
    }

    @Override
    public int addPatientDoctor(PatientDoctor patientDoctor) {
        return patientDoctorDao.insertPatientDoctor(patientDoctor);
    }

    @Override
    public int editPatientDoctor(PatientDoctor patientDoctor) {
        return patientDoctorDao.updatePatientDoctor(patientDoctor);
    }

    @Override
    public String getDocNameByDocId(String doc_id) {
        return patientDoctorDao.findDocNameByDocId(doc_id);
    }

    @Override
    public int removePatientDoctor(Integer id) {
        return patientDoctorDao.deletePatientDoctorById(id);
    }

    @Override
    public List<PatientDoctor> getPatientDoctorsByName(String name) {
        return patientDoctorDao.findPatientDoctorsByName(name);
    }

    @Override
    public List<PatientDoctor> getPatientsByDocId(String doc_id) {
        return patientDoctorDao.findPatientsByDocId(doc_id);
    }
    @Override
    public int updateStatusById(Integer id, String status) {
        return patientDoctorDao.updateStatusById(id, status);
    }

    @Override
    public PatientInfo getPatientInfoByPatientId(String patient_id) {
        return patientDoctorDao.findPatientInfoByPatientId(patient_id);
    }

}